package cn.smartorigin.soas.frame;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

public class ImagePanel extends JPanel{
	
//    private String backgroundImageURL = "login_background.png";
//    private TexturePaint paint = FreeUtil.createTexturePaint(backgroundImageURL);
    
	ImageIcon imgIcn;
    
    public ImagePanel(ImageIcon imgIcn){
		this.imgIcn = imgIcn;
	    this.setBackground(null);
    }
	
    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);

 //       Graphics2D g2d = (Graphics2D) g;
//        g2d.setPaint(paint);
//        g2d.fillRect(0, 0, this.getWidth(), this.getHeight());
        Image img = imgIcn.getImage();
        g.drawImage(img, 0, 0, this.getWidth(), this.getHeight(), null);
    }

}
